clear
set more off
set scheme s1color

use "AnalysisData.dta", clear

*Set control variables 
local controls age ageSq female numerate stockowner stocknewsfollows collegedegree highincome lowincome
local news news_socialmedia news_print news_online news_radio news_tv 


*** Table 1: Consumer characteristics and coronavirus attention, concerns, and responses ***
eststo clear
eststo: quietly oprobit CorNewsNum `controls' `news' govgoodjob govpoorjob [pw=weight], r
eststo: quietly oprobit ConcernEc `controls' `news' govgoodjob govpoorjob [pw=weight], r
eststo: quietly oprobit ConcernH `controls' `news' govgoodjob govpoorjob [pw=weight], r
eststo: quietly oprobit ConcernF `controls' `news' govgoodjob govpoorjob [pw=weight], r
eststo: quietly probit CancelledTr `controls' `news' govgoodjob govpoorjob [pw=weight], r
eststo: quietly probit MadeP `controls' `news' govgoodjob govpoorjob [pw=weight], r
esttab, mtitles("News" "Economy" "Health" "Finances" "Travel" "Purchases") label stats(N r2_p, label("N" "R$^2$ pseudo") fmt(0 2)) b(%9.2f) se(%9.2f) star(* 0.10 ** 0.05 *** 0.01) 

*Table 2: Response of  coronavirus concerns to information treatment 
eststo clear
eststo: quietly oprobit ConcernEc Tr `controls' `news' [pw=weight], r
eststo: quietly oprobit ConcernH Tr `controls' `news' [pw=weight], r
eststo: quietly oprobit ConcernF Tr `controls' `news' [pw=weight], r
eststo: quietly oprobit ConcernEc Tr `controls' `news' [pw=weight] if CorNewsNum<3, r
eststo: quietly oprobit ConcernH Tr `controls' `news' [pw=weight]  if CorNewsNum<3, r
eststo: quietly oprobit ConcernF Tr `controls' `news' [pw=weight]  if CorNewsNum<3, r
esttab, mtitles("Economy" "Health" "Finances" "Economy" "Health" "Finances") label stats(N r2_p, label("N" "R$^2$ pseudo") fmt(0 2)) b(%9.2f) se(%9.2f) star(* 0.10 ** 0.05 *** 0.01) 

*** Table 3: Macroeconomic expectations by concerns about coronavirus effects on economy ***
bys CorConcernEconomy: sum UnempDown1 UnempUp1 PiE1 M51 [aw=weight]


*** Figure 1: Coronavirus attention, concern, and response ***
graph bar (percent) [pw=weight], over(CorNewsNumber, relabel(1 "Not" 2 "Somewhat" 3 "Very")) subtitle("A. Following News Closely") ylabel(0(10)50)
graph save CorNews.gph, replace
graph bar (percent) [pw=weight], over(ConcernEconomy, relabel(1 "Not" 2 "Somewhat" 3 "Very")) subtitle("B. Concern about Economy") ylabel(0(10)50)
graph save ConcernEconomy.gph, replace
graph bar (percent) [pw=weight], over(ConcernHealth, relabel(1 "Not" 2 "Somewhat" 3 "Very")) subtitle("C. Concern about Health") ylabel(0(10)50)
graph save ConcernHealth.gph, replace
graph bar (percent) [pw=weight], over(ConcernFinance, relabel(1 "Not" 2 "Somewhat" 3 "Very")) subtitle("D. Concern about Personal Finances") ylabel(0(10)50)
graph save ConcernFinance.gph, replace
graph bar (percent) [pw=weight], over(CancelledTravel, relabel(1 "No" 2 "Yes")) subtitle("E. Cancelled Travel") ylabel(0(20)80)
graph save CancelledTravel.gph, replace
graph bar (percent) [pw=weight], over(MadePurchases, relabel(1 "No" 2 "Yes")) subtitle("F. Made Purchases") ylabel(0(20)80)
graph save MadePurchases.gph, replace
graph combine CorNews.gph ConcernEconomy.gph ConcernHealth.gph ConcernFinance.gph CancelledTravel.gph MadePurchases.gph, cols(2)
graph display, ysize(16) xsize(14)
graph export Figure1.png, replace
foreach g in CorNews.gph ConcernEconomy.gph ConcernHealth.gph ConcernFinance.gph CancelledTravel.gph MadePurchases.gph {
	erase `g'
}


*** Figure 2: Expectations and revisions by knowledge of rate cut ***
graph bar (percent) [pw=weight] if KnowFedCut==0, over(UnempE1Num, relabel(1 "Less" 2 "Same" 3 "More")) subtitle("A. Unemp. exp., no prior knowlege") ylabel(0(25)75) scale(1.2)
graph save UnempE1DontKnow.gph, replace
graph bar (percent) [pw=weight] if KnowFedCut==1, over(UnempE1Num, relabel(1 "Less" 2 "Same" 3 "More")) subtitle("B. Unemp. exp., prior knowledge") ylabel(0(25)75) scale(1.2)
graph save UnempE1Know.gph, replace
graph bar (percent) [pw=weight] if KnowFedCut==0, over(RevPiNum, relabel(1 "Revise down" 2 "Same" 3 "Revise up")) subtitle("E. Inflation revision, no prior knowledge") ylabel(0(25)75) scale(1.2)
graph save RevPiDontKnow.gph, replace
graph bar (percent) [pw=weight] if KnowFedCut==1, over(RevPiNum, relabel(1 "Revise down" 2 "Same" 3 "Revise up")) subtitle("F. Inflation revision, prior knowledge") ylabel(0(25)75) scale(1.2)
graph save RevPiKnow.gph, replace
graph bar (percent) [pw=weight] if KnowFedCut==0, over(RevUNum, relabel(1 "More Pess." 2 "Same" 3 "More Opt.")) subtitle("C. Unemp. revision, no prior knowledge") ylabel(0(25)75) scale(1.2)
graph save RevUDontKnow.gph, replace
graph bar (percent) [pw=weight] if KnowFedCut==1, over(RevUNum, relabel(1 "More Pess." 2 "Same" 3 "More Opt.")) subtitle("D. Unemp. revision, prior knowledge") ylabel(0(25)75) scale(1.2)
graph save RevUKnow.gph, replace
graph combine UnempE1DontKnow.gph UnempE1Know.gph RevUDontKnow.gph RevUKnow.gph RevPiDontKnow.gph RevPiKnow.gph, cols(2)
graph export Figure2.png, replace
foreach g in UnempE1DontKnow.gph UnempE1Know.gph RevUDontKnow.gph RevUKnow.gph RevPiDontKnow.gph RevPiKnow.gph {
	erase `g'
}

*** Appendix Table A1: Summary statistics of respondent demographics ***
sum female college lowinc highinc age

*** Appendix Table A2: Correlations between variables measuring coronavirus-related concerns and responses ***
polychoric CorNewsNumber ConcernEconomy ConcernHealth ConcernFinance CancelledTravel MadePurchases [pw=weight]

*** Appendix Table A3: Correlations between opinion of government economic policy and confidence in the President and Federal Reserve  ***
polychoric govopinion conftrump conffed [pw=weight]

*** Appendix Table A4: Summary statistics of respondent observables for treatment and control groups ***
bys Treated: sum `controls' `news' [aw=weight]

*** Appendix Table A5: Effect of living in states mentioned in information treatment on concerns and expectations ***
eststo clear
eststo: quietly oprobit ConcernEc S Treated S_Treated `controls' `news' [pw=weight], r
eststo: quietly oprobit ConcernH S Treated S_Treated `controls' `news' [pw=weight], r
eststo: quietly oprobit ConcernF S Treated S_Treated `controls' `news' [pw=weight], r
eststo: quietly reg PiE1 S Treated S_Treated `controls' `news' [pw=weight], r
eststo: quietly oprobit UnempE1Num S Treated S_Treated `controls' `news' [pw=weight], r
eststo: quietly oprobit govopinion S Treated S_Treated `controls' `news' [pw=weight], r
esttab, `RegOptions' mtitles("Economy" "Health" "Finances" "Inflation" "Unemp." "Gov Policy") label stats(N r2_p, label("N" "R$^2$ pseudo") fmt(0 2)) b(%9.2f) se(%9.2f) star(* 0.10 ** 0.05 *** 0.01) 

*** Appendix Table A6: Correlations between knowledge of rate cut, inflation target, and Fed Chair ***
polychoric KnowFe targetk chairk [pw=weight]

*** Appendix Table A7: Consumer characteristics and awareness of Fed policy ***
eststo clear
eststo: quietly probit KnowFedCut `controls' `news' govgoodjob govpoorjob [pw=weight], r
eststo: quietly probit targetknow `controls' `news' govgoodjob govpoorjob [pw=weight], r
eststo: quietly probit chairknow `controls' `news' govgoodjob govpoorjob [pw=weight], r
esttab, `RegOptions' mtitles("Rate Cut" "Target" "Chair") label stats(N r2_p, label("N" "R$^2$ pseudo") fmt(0 2)) b(%9.2f) se(%9.2f) star(* 0.10 ** 0.05 *** 0.01) 

*** Appendix Table A8: Revisions to inflation expectations by revisions to unemployment expectations  ***
bys RevUNum: sum RevPiDown Rev0 RevPiUp [aw=weight]

*** Appendix Figure A1: Expectations and revisions by knowledge of rate cut for respondents spending at least 4 minutes on survey***
drop if Duration<=240
graph bar (percent) [pw=weight] if KnowFedCut==0, over(UnempE1Num, relabel(1 "Less" 2 "Same" 3 "More")) subtitle("A. Unemp. exp., no prior knowlege") ylabel(0(25)75) scale(1.2)
graph save UnempE1DontKnow.gph, replace
graph bar (percent) [pw=weight] if KnowFedCut==1, over(UnempE1Num, relabel(1 "Less" 2 "Same" 3 "More")) subtitle("B. Unemp. exp., prior knowledge") ylabel(0(25)75) scale(1.2)
graph save UnempE1Know.gph, replace
graph bar (percent) [pw=weight] if KnowFedCut==0, over(RevPiNum, relabel(1 "Revise down" 2 "Same" 3 "Revise up")) subtitle("E. Inflation revision, no prior knowledge") ylabel(0(25)75) scale(1.2)
graph save RevPiDontKnow.gph, replace
graph bar (percent) [pw=weight] if KnowFedCut==1, over(RevPiNum, relabel(1 "Revise down" 2 "Same" 3 "Revise up")) subtitle("F. Inflation revision, prior knowledge") ylabel(0(25)75) scale(1.2)
graph save RevPiKnow.gph, replace
graph bar (percent) [pw=weight] if KnowFedCut==0, over(RevUNum, relabel(1 "More Pess." 2 "Same" 3 "More Opt.")) subtitle("C. Unemp. revision, no prior knowledge") ylabel(0(25)75) scale(1.2)
graph save RevUDontKnow.gph, replace
graph bar (percent) [pw=weight] if KnowFedCut==1, over(RevUNum, relabel(1 "More Pess." 2 "Same" 3 "More Opt.")) subtitle("D. Unemp. revision, prior knowledge") ylabel(0(25)75) scale(1.2)
graph save RevUKnow.gph, replace
graph combine UnempE1DontKnow.gph UnempE1Know.gph RevUDontKnow.gph RevUKnow.gph RevPiDontKnow.gph RevPiKnow.gph, cols(2)
graph export FigureA1.png, replace
foreach g in UnempE1DontKnow.gph UnempE1Know.gph RevUDontKnow.gph RevUKnow.gph RevPiDontKnow.gph RevPiKnow.gph {
	erase `g'
}


*** Appendix Figure A2: Kernel density estimate for revisions to inflation expectations ***
use "AnalysisData.dta", clear
graph twoway (kdensity RevPi if RevPi>=-10 & RevPi<=10 & Know==0 [aw=weight], bwidth(0.5))(kdensity RevPi if RevPi>=-10 & RevPi<=10 & Know==1 [aw=weight], bwidth(0.5) lpattern(dash)), scale(1.1) xtitle("Revision to Inflation Forecast") ytitle("") legend(ring(0) bplacement(neast) cols(1) label(1 "No prior knowledge") label(2 "Prior knowledge"))
graph export FigureA2.png, replace
